package com.antdesignbackend.backend.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.antdesignbackend.backend.common.http.HttpClientResult;
import com.antdesignbackend.backend.common.http.HttpClientUtils;
import com.antdesignbackend.backend.config.WebConfig;

/**
 * Created by Administrator on 2020/6/8.
 */
public class DemoController {
    public static void main(String[] args) throws Exception {
        String token="";
        String url=String.format("https://api.weixin.qq.com/cgi-bin/token?grant_type=%s&appid=%s&secret=%s","client_credential",WebConfig.APPID,WebConfig.AppSecret);
        try
        {
            HttpClientResult httpClientResult= HttpClientUtils.doGet(url);
            if (httpClientResult!=null && httpClientResult.getCode() == 200) {
                String content=httpClientResult.getContent();
                JSONObject parseObject = JSONArray.parseObject(content);
                Object obj =parseObject.get("access_token");
                if(obj!=null)
                    token=obj.toString();
            }
            //消息模版



        }catch (Exception ex)
        {

        }
    }
}
